home *** CD-ROM | disk | FTP | other *** search
/ Champak 50 / Volume 50 - JOGO DISK .iso / Games / marionettemadness.swf / scripts / __Packages / getURLManager.as next >
Text File  |  2007-10-01  |  1KB  |  58 lines

  1. class getURLManager
  2. {
  3.    function getURLManager(frequency)
  4.    {
  5.       this.callQueue = new Array();
  6.       this.processing = false();
  7.       if(frequency == undefined)
  8.       {
  9.          this.freq = 1000;
  10.       }
  11.       this.me = this;
  12.    }
  13.    function executeCall()
  14.    {
  15.       this.lastCall = getTimer();
  16.       var _loc2_ = this.callQueue.shift();
  17.       if(_loc2_.href.indexOf("javascript") != -1 || _loc2_.win == undefined || _loc2_.win == "" || _loc2_.win == null)
  18.       {
  19.          getURL(_loc2_.href,"");
  20.       }
  21.       else
  22.       {
  23.          getURL(_loc2_.href,_loc2_.win);
  24.       }
  25.    }
  26.    function stopCalling()
  27.    {
  28.       delete this.me.onEnterFrame;
  29.       this.processing = false;
  30.    }
  31.    function startCalling()
  32.    {
  33.       if(!this.processing)
  34.       {
  35.          this.lastCall = getTimer();
  36.          this.me.onEnterFrame = function()
  37.          {
  38.             if(getTimer() - this.lastCall > this.freq)
  39.             {
  40.                this.executeCall();
  41.             }
  42.             if(this.callQueue.length < 1)
  43.             {
  44.                this.me.stopCalling();
  45.             }
  46.          };
  47.          this.processing = true;
  48.          this.executeCall();
  49.       }
  50.    }
  51.    function addToQueue(inURL, inWindow)
  52.    {
  53.       var _loc2_ = {href:inURL,win:inWindow};
  54.       this.callQueue.push(_loc2_);
  55.       this.startCalling(this.callQueue);
  56.    }
  57. }
  58.